When a wiring pattern is formed on a semiconductor wafer, there is adopted the method including the steps of applying on the semiconductor wafer a coating material which is called resist; applying masking of a wiring pattern on the resist, and then irradiating the resist with visible rays or ultraviolet rays; and exposing the resist to the visible rays, the ultraviolet rays, or an electron beam to form the wiring pattern. The wiring pattern obtained by this method is subject to changes in a tilt angle and a shape of a slope part of the wiring pattern depending on the intensity and diaphragm of the visible rays, the ultraviolet rays, or the electron beam, with which the wiring pattern is irradiated. Therefore, in order to form a wiring pattern with a high degree of accuracy, it is necessary to measure a three-dimensional shape of the wiring pattern and thereby to inspect the wiring pattern. For the purpose of this inspection, if a wafer is cut to measure its cross-sectional shape, it is possible to accurately measure the cross-sectional shape. However, it requires both labor and cost. For this reason, there has been proposed the technique for measuring a cross-sectional shape of a pattern nondestructively and in a noncontact manner by use of an image of an electron microscope. For example, there is the technique for measuring a cross-sectional shape by use of the “shape from shading” method and the stereo matching method in combination. More specifically, characteristics of a signal waveform detected by a secondary electron detector of an electron microscope are detected, and then an absolute value of the height of a cross section is measured by stereo matching of the characteristics, and thereby a shape between the characteristics is determined by the “shape from shading” method. A technique for restoring an accurate three-dimensional shape is disclosed in, for example, Japanese Patent Application Laid-Open No. Hei 5-181980, which is capable of coping with a sudden change in surface of a target to be measured. In this literature, an edge is detected from two-dimensional brightness image data, and then a parameter representing the smoothness of a surface of an object is calculated from the edge to restore a three-dimensional shape of the object by use of this parameter.
However, as for the technique that uses the conventional stereo matching method, characteristics are displaced in their matching if a SN ratio of an input signal is low, resulting in a great error in measurement of a three-dimensional shape. In addition, the technique that uses the spectra CD requires measurement data to build a database. In this case, a pattern which can be measured is limited to an iteration structure (lattice pattern) of lines. Moreover, its output is not three-dimensional image display but numeric data (the width and the height of wiring, and a tilt angle), which is not sufficient to display a three-dimensional shape.